﻿module Enferno.Public.Web.Components.Models {
    
    export enum PaymentStatus {
        Ok = 0,
        Error = 1
    }

    export class PaymentResponseModel {
        public httpMethod: string;
        public statusDescription: string;
        public status: PaymentStatus
        public redirectParameters: Object;
        public redirectUrl: string;
        public successUrl: string;
        public orderNo: string;

        constructor(serverObject?: any) {
            if (serverObject != null) {
                this.createFromServerObject(serverObject);
            }
        }

        private createFromServerObject(serverObject: any) {
            this.status = serverObject.status;
            this.statusDescription = serverObject.statusDescription;
            this.redirectUrl = serverObject.redirectUrl ? serverObject.redirectUrl.trim() : null;
            this.successUrl = serverObject.successUrl;
            this.httpMethod = serverObject.httpMethod;
            this.orderNo = serverObject.orderNo;
            this.redirectParameters = serverObject.redirectParameters;
        }

    }

} 